﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Settlement.aspx.cs" Inherits="Maticsoft.Web.wap.Settlement" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <!--#include file="include/head.htm"-->
    <style type="text/css">
        .addr-red
        {
            border: 1px solid #ff0000;
        }
    </style>
    <script type="text/javascript">
        function Addr() {
            $.layer({
                type: 2,
                title: '收货地址',
                iframe: { src: 'Addr.aspx' },
                area: ['400px', '350px'],
                offset: ['100px', '']
            });
        }

        function SetAddr(id) {
            $("div[id^='addr']").attr("class", "tc-gray");
            $("#addr" + id).attr("class", "addr-red");
            $("#hidDeliveryId").val(id);
        }

        function AddOrder() {
            if ($("#hidDeliveryId").val() == "") {
                alert("请选择配送地址");
                return;
            }
            $.ajax({
                type: "get",
                url: "Settlement.aspx",
                data: "sync=true&delivery=" + $("#hidDeliveryId").val() + "&ids=<%=Request.QueryString["ids"] %>&payway=&d=" + new Date().toString(),
                success: function (msg) {
                    var obj = eval('(' + msg + ')');
                    if (obj.code == "1") {
                        alert("订单提交成功");
                        window.location.href = "/wap/pay/alipay/default.aspx?orderid=" + obj.data.orderid + "&fee=" + obj.data.total + "&name=" + escape("购买商品") + "&remark=";
                    }
                },
                error: function (msg) {
                    alert("出错啦");
                }
            })
        }

        $(function () {
            if ($("#hidDeliveryId").val() != "") {
                SetAddr($("#hidDeliveryId").val());
            }
        })
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <header class="mui-bar">
			<a class="mui-action-back gotoup mui-pull-left"></a>
			<h1 class="mui-title">确认订单</h1>
            <a class="mui-pull-right tc-black" href="UserAddrAdd.aspx?ids=<%=Request.QueryString["ids"] %>">新建</a>
		</header>
    <div class="mui-content">
        <asp:Repeater ID="Repeater1" runat="server">
            <ItemTemplate>
                <div class="mui-table-view-cell" id="addr<%#Eval("DeliveryId") %>" onclick="SetAddr(<%#Eval("DeliveryId") %>);">
                    <a class="mui-navigate-right" href="javascript:;">
                        <h5 class="tc-gray">
                            <%#Eval("Name")%>
                            <%#Eval("Mobile")%></h5>
                        <h6 class="tc-gray">
                            <img src="img/Shape-3.png" class="icons-add"><%#GetLocation(Eval("locationId"))+" "+Eval("Address")%></h6>
                    </a>
                </div>
                <div style="width: 100%; height: 1px; background-color: #ccc; border: 0px;">
                </div>
            </ItemTemplate>
        </asp:Repeater>
        <input id="hidDeliveryId" runat="server" type="hidden" />
        <ul class="mui-table-view mar-btm-10">
            <asp:Repeater ID="Repeater2" runat="server">
                <ItemTemplate>
                    <li class="mui-table-view-cell shop-car">
                        <div class="mui-media">
                            <img src="/uploadpic/<%#Eval("Pic") %>" class="mui-media-object">
                            <div class="mui-media-body">
                                <h5 class="mui-ellipsis-2 tc-black" style="margin-top: 0;">
                                    <%#Eval("ProductName") %></h5>
                                <h6 class="mui-ellipsis tc-lgray">
                                    规格：<%#Eval("ProductDesc")%></h6>
                                <div class="mui-row">
                                    <h4 class="tc-red mui-pull-left" style="margin: 0;">
                                        <%#Eval("SalePrice")%></h4>
                                    <h6 class="tc-lgray mui-pull-right">
                                        <%#Eval("ProductNum") %></h6>
                                </div>
                            </div>
                        </div>
                    </li>
                </ItemTemplate>
            </asp:Repeater>
        </ul>
        <!--
        <ul class="mui-table-view mem-cent-box">
            <li class="mui-table-view-cell">
                <h5 class="mui-pull-left tc-black">
                    发票信息</h5>
                <a class="mui-navigate-right mui-pull-right tc-lgray mui-h5" style="padding-right: 40px;"
                    href="#">明细(纸质)-个人 </a></li>
        </ul>
        -->
        <div class="fix-btm-0 bg-white">
            <div class="mui-checkbox mui-left">
                <div class="mui-media" style="padding-left: 0px;">
                    <button style="width: 25%; float: right; border-radius: 0; padding: 6px 6px" type="button"
                        onclick="AddOrder();">
                        <h5 class="tc-white mui-pull-right">
                            提交订单</h5>
                    </button>
                    <h5 class="tc-black mui-pull-right" style="line-height: 32px; padding-right: 10px;">
                        合计:<span class="tc-red">￥<asp:Literal ID="ltlTotal" runat="server"></asp:Literal></span>
                        含运费:<span class="tc-red">￥<asp:Literal ID="ltlDeliveryFee" runat="server"></asp:Literal></span></h5>
                </div>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
